Track max buffer usage in memory channel statistics - #3474
Conversation
Add a max_buffer_used field to MemoryChannelStatistics that reports the largest number of items the channel's buffer has held at once since it was created. This lets users pick a sensible max_buffer_size based on data from a real run instead of guessing. Closes python-trio#1723
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3474 +/- ##
===============================================
Coverage 100.00000% 100.00000%
===============================================
Files 128 128
Lines 19449 19458 +9
Branches 1320 1320
===============================================
+ Hits 19449 19458 +9
🚀 New features to boost your workflow:
|
|
@pctablet505 One suggestion: I get that the "used" bit of |
max_buffer_used read as a configured limit rather than a runtime metric, easily confused with max_buffer_size. peak_buffer_used pairs more clearly with the existing current_buffer_used field.
|
Hey @pctablet505, it looks like that was the first time we merged one of your PRs! Thanks so much! 🎉 🎂 If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:
If you want to read more, here's the relevant section in our contributing guide. Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you. If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out! |
Adds a
max_buffer_usedfield toMemoryChannelStatistics, tracking the largest number of items the channel's buffer has ever held at once.The use case: when you need buffering but
math.infisn't a reasonablemax_buffer_size, this makes it possible to observe real-world peak usage during a run and pick a sensible limit, instead of guessing.Closes #1723